package com.david.jetpack.databinding

import android.app.Activity
import android.os.Bundle
import android.util.Log
import androidx.databinding.DataBindingUtil
import com.david.jetpack.R

 class DataBindingActivity:Activity() {
//
    companion object{
        var test:ArrayList<Any> = ArrayList()
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
//        DataBindingUtil.inflate<>()
        test.add(this)
        val binding: ActivityDatabindingBinding = DataBindingUtil.setContentView<ActivityDatabindingBinding>(this, R.layout.activity_databinding)
        binding.user = User("san", "zhang")
        binding.bindingTest.setOnClickListener {
            binding.test2.text = "测试"

            Log.e("test", (binding.user as User).firstName)
        }
        setContentView(binding.root)

//        binding.unbind()
    }
}